#include"set.h"

namespace ybc
{
	void test1()
	{
		set<int> s;
		s.insert(5);
		s.insert(1);
		s.insert(3);
		s.insert(4);
		s.insert(2);

		auto it = s.end();
		while (it != s.begin())
		{
			--it;
			cout << *it << " ";
		}
		cout << endl;
		auto cit = s.cbegin();
		while (cit != s.cend())
		{
			cout << *cit << " ";
			++cit;
		}
		cout << endl;
	}

	template<class T>
	void print(set<T>& s)
	{
		auto it = s.begin();
		while (it != s.end())
		{
			cout << *it << " ";
			++it;
		}
		cout << endl;
	}

	void test2()
	{
		set<int> s;
		int a[] = { 4, 2, 6, 1, 3, 5, 15, 7, 16, 14 };
		for (auto e : a)
		{
			s.insert(e);
		}
		for (auto e : s)
		{
			cout << e << " ";
		}
		cout << endl;
		print(s);
	}
}

int main()
{
	ybc::test1();

	//ybc::test2();

	return 0;
}